Document policyengine.py household-impact zero-return diagnosis (#1628)#1729
Open
vahid-ahmadi wants to merge 1 commit into
Open
Document policyengine.py household-impact zero-return diagnosis (#1628)#1729vahid-ahmadi wants to merge 1 commit into
vahid-ahmadi wants to merge 1 commit into
Conversation
#1628 reported that two policyengine.py household-impact integration tests started asserting 0.0 for expected-positive tax / child-benefit values after bumping to policyengine-uk==2.88.0. Reproducing the same scenarios directly against policyengine-uk shows the model is healthy: a £50k single adult correctly returns £7,486 income tax, and a couple with one child correctly returns £1,354.60 child benefit at 2025 rates. The figures are stable across 2022-2025. So the regression is upstream in policyengine.py's test harness, not a model bug. Most likely cause: the harness depending on the model's default_input_period (2025) vs the year encoded in the test fixture, or being broken by the default-dataset env var requirement introduced since the previous 2.74 pin. Persist the diagnosis as a docs page so the next reviewer of #1628 gets a one-stop explanation. Guidance for the upstream fix: - pass explicit period= to every calculate() call, - use Microsimulation(situation=...) for single-household queries (no dataset needed), - assert against the fixture-encoded year rather than the model's default. Cross-links to mp30k-uk-switch-plan.md which documents the env-var contract this issue collides with.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
policyengine.pyhousehold-impact integration tests started asserting0.0for expected-positive tax / child-benefit values after bumping the UK extra topolicyengine-uk==2.88.0.policyengine-ukmain:income_tax = 7486.00✓child_benefit = 1354.60✓policyengine.pytest-harness regression, most likely from:default_input_period/default_calculation_perioddefaulting to 2025 (so a 2024 situation queried at the default returns 0 for unset inputs), ordocs/book/validation/policyengine-py-household-impact.mddocumenting the diagnosis from the UK side and providing guidance for the upstream fix (pass explicitperiod=, useMicrosimulation(situation=...)for single-household queries, assert against the fixture-encoded year).mp30k-uk-switch-plan.mdwhich documents the env-var contract this collides with.policyengine.py's test harness.Test plan
Microsimulation(situation=...); figures match the expected values.validation/.🤖 Generated with Claude Code